
    <%@ include file="../common.jsp"%>
<script type="text/javascript">
	$(document).ready(
		
			function() {
				$("#department").attr("action",'<c:url value="/saveDepartment.htm"></c:url>');
				$("#deparmentName").focus();
			});
		
</script>

<form:form commandName="departmentForm" id="department">
	<table class="adminFilterTable">
		<tr class="tableChildHeaderColor">
			<td colspan="5" align="center"> ADD NEW DEPARTMENT </td>
		</tr>
		<tr class="formSpacingRow"><td></td> </tr>
		<tr> 
			<td align="left" colspan="5" style="font-family: verdana; font-size: 12px;"> All fields are mandatory.</td> 
		</tr>
		<tr class="formSpacingRow"><td></td> </tr>
		<tr>
			<td class="spacingColumnWidthLess"></td>
			<td class="formLabel"> Name </td>
			<td class="spacingColumnWidthLess"></td>
			<td class="formField">
				<form:input path="ddName" id="deparmentName"/>
				<form:errors path="ddName" cssClass="errorMessage"></form:errors>
			</td>
			<td class="spacingColumnWidthLess"></td>
		</tr>
		<tr class="formSpacingRow"><td></td> </tr>
		<tr>
			<td class="spacingColumnWidthLess"></td>
			<td class="formLabel"> Code </td>	
			<td class="spacingColumnWidthLess"></td>
			<td class="formField"> <form:input path="ddShortName"/>	
				 <form:errors path="ddShortName" cssClass="errorMessage"></form:errors>
			</td>
			<td class="spacingColumnWidthLess"></td>
		</tr>
		<tr class="formSpacingRow"><td></td> </tr>
		<tr class="even" align="center">
			<td class="spacingColumnWidthLess"></td>
			<td></td>
			<td class="spacingColumnWidthLess"></td>
			<td colspan="3" align="left"> <input class="formButton ui-corner-all" type="button" value="Save" onclick="javascript:addEntity('department')"> </td>
		</tr>
		<tr class="formSpacingRow"><td></td> </tr>
	</table>
</form:form>

<c:if test="${errorCount eq 0}">
	<c:choose>
		<c:when test="${resultOfEntry}">
			Operation Done Successfully
		</c:when>
		<c:otherwise>
			<label class="errorMsg"> Error. Department Already Exists. </label>
		</c:otherwise>
	</c:choose>
</c:if>